package org.test.netty;

import java.util.ArrayList;
import java.util.List;

import org.test.model.UserVO;
/**
 * 模拟用户数据
 * @author liuzhen
 *
 */
public class UserGroup {

	public static List<UserVO> userList = new ArrayList<UserVO>();
	
	 static {
		userList.add(new UserVO("test1","test1","123456","离镜","/images/lijing.jpg"));
		userList.add(new UserVO("test2","test2","123456","窈窕淑女","/images/test2.jpg"));
		userList.add(new UserVO("test3","test3","123456","白凤九","/images/fengjiu.jpg"));
		userList.add(new UserVO("test4","test4","123456","夜华","/images/yehua.jpg"));
		userList.add(new UserVO("test5","test5","123456","白浅","/images/baiqian.jpg"));
		userList.add(new UserVO("test6","test6","123456","666",""));
	}
	
	public static void add(UserVO user) {
		userList.add(user);
	}
	
	public static void remove(UserVO user) {
		userList.remove(user);
	}
	
	public static List<UserVO> findAllUser(){
		return userList;
	}
	
	public static UserVO findUser(String userName,String userPwd) {
		UserVO resutUser = null;
		for (UserVO userVO : userList) {
			if(userName.equals(userVO.userName) && userPwd.equals(userVO.userPwd)) {
				resutUser = userVO;
				break;
			}
		}
		return resutUser;
	}
}
